using System;
using System.Collections;
using System.Web;
using Sedna.Core.Controller.Common;
using log4net;

namespace Sedna.Core.Controller
{
	public class LogAndIgnoreExceptionHandler : AbstractExceptionHandler
	{
		ILog log = LogManager.GetLogger(typeof(LogAndIgnoreExceptionHandler));

		private bool suppressLog = false;

		public LogAndIgnoreExceptionHandler()
		{
		}

		public bool SuppressLog
		{
			get { return suppressLog; }
			set { suppressLog = value; }
		}

		public override IActionResult HandleException(IExecutionContext executionContext, Exception exception)
		{
			if(!suppressLog)
			{
				log.Debug("caught exception", exception);
			}
			return new ActionResult(successStatus);
		}
	}
}
